package com.itheima.controller;

import com.itheima.pojo.Area;
import com.itheima.pojo.Result;
import com.itheima.service.AreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/area")
public class AreaController {

    @Autowired
    private AreaService areaService;

    @GetMapping
    public Result<List<Area>> list(Integer cid){
        return Result.success(areaService.list(cid));
    }

}
